package com.tanhua.model.vo;

import com.tanhua.model.mongo.Proclamation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.beans.BeanUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProclamationVo {
    private static final long serialVersionUID = 6739966698394686523L;
    private String id; //主键id

    private String title;//标题
    private String description;//标题
    private Long created; //创建时间
    private String createDate;//发布时间


    public static ProclamationVo init(Proclamation proclamation){
        ProclamationVo proclamationVo = new ProclamationVo();
        BeanUtils.copyProperties(proclamation,proclamationVo);
        ObjectId id = proclamation.getId();
        String s = id.toString();
        proclamationVo.setId(s);
        return proclamationVo;
    }
}
